package com.wc.算法提高课.A第一章_动态规划.斜率优化DP.任务安排;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/5/14 1:07
 * @description https://www.acwing.com/problem/content/302/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 5010;
    static long INF = 0x3f3f3f3fL * 0x3f3f3f3f;
    static int[][] a = new int[N][2];
    static int[] sumT = new int[N], sumC = new int[N];
    // f[i]表示前i的分配的所有方案中以i结尾的最小分配值
    static long[] f = new long[N];
    static int n;
    static long S;

    public static void main(String[] args) {
        n = sc.nextInt();
        S = sc.nextLong();
        for (int i = 1; i <= n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
            sumT[i] += a[i][0] + sumT[i - 1];
            sumC[i] += a[i][1] + sumC[i - 1];
        }
        Arrays.fill(f, 1, n + 1, INF);
        f[0] = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < i; j++) {
                f[i] = Math.min(f[i], f[j] + (long) sumT[i] * (sumC[i] - sumC[j]) + S * (sumC[n] - sumC[j]));
            }
        }
        out.println(f[n]);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
